class UserGroup < ActiveRecord::Base
  has_many :user_group_memberships
  has_many :users, :through => :user_group_memberships
  
  validates_presence_of :name
  validates_uniqueness_of :name
  
  def add_user(user)
    users << user unless(user==:false || users.include?(user))
  end
  
  def remove_user(user)
    users.delete(user) if(user!=:false && users.include?(user))
  end
end
